home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / mindos11.zip / MHEXBUF.C < prev    next >
C/C++ Source or Header  |  1991-03-22  |  1KB  |  56 lines

  1. /*  mhexbuf.c   -- print a Minix buffer in hex */
  2. /*  Copyright 1988,1991 Steven W. Harrold - All rights reserved. */
  3. /*  $Header: MHEXBUF.C_V 1.2 91/03/19 09:57:59 SWH Exp $ */
  4.  
  5. #include    <stdio.h>
  6. #include    <ctype.h>
  7. #include    "mfs.h"
  8.  
  9.  
  10. /*==================================================================*/
  11. void print_hex_buf (buffer, blkno, title)
  12. void    *buffer ;
  13. int     blkno ;
  14. char    *title ;
  15. {
  16.     int     i, j ;
  17.     byte    c ;
  18.     byte    *buf = buffer ;
  19.  
  20.     printf ("****  %05u - %s  ****\n", blkno, title) ;
  21.  
  22.     for (i=0; i<BLOCK_SIZE; i+=16)
  23.     {
  24.         printf ("%04X.   ", i) ;
  25.  
  26.         for (j=0; j<8; j++)
  27.             printf ("%02X ", (buf[i+j]& 0xff)) ;
  28.  
  29.         printf ("- ") ;
  30.  
  31.         for (j=8; j<16; j++)
  32.             printf ("%02X ", (buf[i+j]& 0xff)) ;
  33.  
  34.         printf ("  *") ;
  35.  
  36.         for (j=0; j<16; j++)
  37.         {
  38.             c = buf[i+j] ;
  39.             if (isprint(c))
  40.                 printf ("%c", c) ;
  41.             else
  42.                 printf (".") ;
  43.  
  44.         } /* for j */
  45.  
  46.         printf ("*\n") ;
  47.  
  48.     } /* for i */
  49.  
  50.     printf ("\n") ;
  51.  
  52. } /* print_hex_buf() */
  53.  
  54.  
  55. /*---eof---*/
  56.